!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("rb_wixui.thunderbolt[ComboBoxInputListModal]",["react"],t):"object"==typeof exports?exports["rb_wixui.thunderbolt[ComboBoxInputListModal]"]=t(require("react")):e["rb_wixui.thunderbolt[ComboBoxInputListModal]"]=t(e.React)}("undefined"!=typeof self?self:this,(function(e){return function(){var t={5329:function(t){"use strict";t.exports=e},448:function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;t{},u="designable_list",c="designable_list_option",a=function(e,t){const n=e.offsetTop,o=n+e.getBoundingClientRect().height,r=t.scrollTop,i=r+t.offsetHeight;return n>=r&&o<=i};var f="sTe93V",d="DYoNOT",p="_Gybpq",v="CEK3nk",b="P6sHUt";const x={ComboBoxInputListModal:{component:e=>{const{id:n,value:o,options:r,hoveredOptionIndex:x,className:g,setDesignableListElem:m=l,setHoveredOptionIndex:h=l,onSelectedOptionChange:y=l}=e,E=e.filteredOptions||e.options,[O,_]=s.useState(null),[M,C]=s.useState(!1),j=s.useRef(null),I=s.useRef(null),R=s.useRef(null),T=s.useRef(null),[S,B]=s.useState({"--optionLineHeight":"1.3em"}),L=function(e,t){void 0===t&&(t=null);const n=(0,s.useRef)(t);return(0,s.useEffect)((()=>{n.current=e}),[e]),n.current}(x)||0,k=s.useCallback((()=>{const e=I.current;if(e){const t=e.getBoundingClientRect();B({"--optionLineHeight":0===t.height?"1.3em":t.height+"px"})}}),[I]);(e=>{let{callback:t,ref:n,elem:o}=e;(0,s.useEffect)((()=>{const e=new ResizeObserver(t);return null!=n&&n.current&&e.observe(n.current),o&&e.observe(o),()=>{e.disconnect()}}),[n,o,t])})({ref:I,callback:k});s.useEffect((()=>{const e=R.current||j.current;e&&O&&(O.scrollTop=e.offsetTop)}),[O,S]);const w=s.useMemo((()=>E.findIndex((e=>e.value===o))),[E,o]);s.useEffect((()=>{const e=T.current||R.current||j.current;M||-1===x||(x>=L?(e=>{let{optionEl:t,listEl:n}=e;t&&n&&!a(t,n)&&(n.scrollTop=t.offsetTop-n.offsetHeight+t.getBoundingClientRect().height)})({optionEl:e,listEl:O}):(e=>{let{optionEl:t,listEl:n,hoveredOptionIndex:o}=e;t&&n&&!a(t,n)&&(n.scrollTop=t.getBoundingClientRect().height*o)})({optionEl:e,listEl:O,hoveredOptionIndex:x}))}),[x,L,O,M]);const H=s.useMemo((()=>r.findIndex((e=>!!e.text))),[r]),N=e=>e===H?I:void 0;return s.createElement("div",t()({id:(P=n,"listModal_"+P)},(e=>Object.entries(e).reduce(((e,[t,n])=>(t.includes("data-")&&(e[t]=n),e)),{}))(e),{className:i(d,g),tabIndex:-1}),s.createElement("div",{ref:e=>{m(e),_(e)},"data-testid":u,className:p,role:"listbox",style:{...S}},r.map(((e,t)=>{return s.createElement("div",{key:t,id:"menuitem-"+t,ref:(n=t,n===w?R:0===n?j:n===x?T:void 0),className:i(v,{[f]:x===t}),onClick:()=>(e=>{y(e.value)})(e),onMouseEnter:()=>(h(t),void C(!0)),onMouseLeave:()=>(h(-1),void C(!1)),"data-testid":c,role:"option","aria-selected":e.value===o,style:e.style},s.createElement("div",{ref:N(t),className:b},e.text));var n}))));var P}}}}(),r}()})); //# sourceMappingURL=https://static.parastorage.com/services/editor-elements-library/dist/thunderbolt/rb_wixui.thunderbolt[ComboBoxInputListModal].24b8dc20.bundle.min.js.map